﻿using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using DevExpress.XtraReports.UI;
using System.Data;

namespace QuanLyThuNgan
{
    public partial class rpt_BienLaiThuTien : DevExpress.XtraReports.UI.XtraReport
    {
        public rpt_BienLaiThuTien()
        {
            InitializeComponent();
        }
        public DataSet ds = new DataSet();
        public DataSet Dds
        {
            get { return ds; }
            set { ds = value; }
        }
        void createprt()
        {
            xrLabel_Ngay.Text ="Ngày: "+Uit.it_Date.CurrentDate("dd/MM/yyyy");
            ds = this.DataSource as DataSet;
           //  xrshs.Text = cbarcode.Bar128(ds.Tables["ThongTinBL"].Rows[0]["sohs"].ToString());
            //xrshs.Text = cbarcode.Bar128(sohs);
            xrNgayGioIn.Text = "Giờ in: " + Uit.it_Date.CurrentDate("hh") +"h "+ Uit.it_Date.CurrentDate("mm") + "'   " + xrLabel_Ngay.Text;
            xrLabel14.Text = "Giờ in: " + Uit.it_Date.CurrentDate("hh") + "h " + Uit.it_Date.CurrentDate("mm") + "'   " + xrLabel_Ngay.Text; 
            //this.DataSource = ds; 
            xrshs.Text = cbarcode.Bar128(ds.Tables["ThongTinBL"].Rows[0]["sohs"].ToString());
        }
        public string donvithu, sohs, hoten, tuoi, tongsotien, nglaphieu, ngthutien, ngayhin;

        private void rpt_BienLaiThuTien_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        { 
            createprt();
            //string sobn = GetCurrentColumnValue("sobn").ToString();
            //string nextCid = GetNextColumnValue("sttmst").ToString();
        }
        bool ktra = false;
        private void xrTTPhaiThu_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrTTPhaiThu.Visible = true;
            else
                xrTTPhaiThu.Visible = false;
        }

        private void xrTT01_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrTT01.Visible = true;
            else
                xrTT01.Visible = false;
        }

        private void xrTT02_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
            {
                xrTT02.Visible = true;
                ktra = true;
            }
            else
            {
                xrTT02.Visible = false;
                ktra = false;
            }
        }

        private void xrttchitiet_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrTT01.Visible = true;
            else
                xrTT01.Visible = false;
        }

        private void xrLabel3_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {//nguoilaptren
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrLabel3.Visible = false;
            else
                xrLabel3.Visible = true;

        }

        private void xrNguoilapPhieu_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrNguoilapPhieu.Visible = true;
            else
                xrNguoilapPhieu.Visible = false;
        }
        
        private void xrLabel14_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {//ngay h in tren
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrLabel14.Visible = false;
            else
                xrLabel14.Visible = true;
        }
        private void xrLabel5_PrintOnPage(object sender, PrintOnPageEventArgs e)
        { // nguoi thu tren

            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrLabel5.Visible = false;
            else
                xrLabel5.Visible = true;
            
        }
        private void xrNguoithutien_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {
          // xrNguoithutien.Visible = xrLabel3.Visible;
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrNguoithutien.Visible = true;
            else
                xrNguoithutien.Visible = false;
        }

        private void xrNgayGioIn_PrintOnPage(object sender, PrintOnPageEventArgs e)
        {
            int kk = e.PageIndex;
            if (kk == e.PageCount - 1)
                xrNgayGioIn.Visible = true;
            else
                xrNgayGioIn.Visible = false;
        } 

    }
}
